$(function () {
    //商品数据
    var shopMap = {};
    //选中的优惠和活动
    var salesMap = {
        'couponCode':"",
        "activityId":0
    };

    $("body").on('click','.delete-shop-box',function () {//删除购物车
        var _this = $(this);
        var parentEM =  _this.parent('div').parent("aside").parent('section');
        //购物车ID
        var shopCartId = $(parentEM).find('input[name="shopCartId"]').val();
        icModale(2,'提示','确认要删除该商品？','确认',null,function (index, ele) {
            //删除购物车
            deleteShopCart(shopCartId,function () {
                layer.close(index);
                //加载订单商品数据
                getPayOrderShopList();
            });
        });

    }).on("click", ".minus-btn", function () {//减购买量
        var _this = $(this);
        updateBuyNum(_this, 1);
    }).on('click', ".add-btn", function () {//加购买量
        var _this = $(this);
        updateBuyNum(_this, 2);
    }).on('change', ".buy-num-in", function () {//改变购买量
        var _this = $(this);
        updateBuyNum(_this, 3);
    }).on('click','#updateAddressBtn',function (event) {//修改收货地址
        var parent = $(this).parents('div.blank-item');
        var addressId = $(parent).data('id');
        event.stopPropagation();
        if(addressId == null || addressId == 'undefined'){
            addressId = 0;
        }
        initSaveAddress(addressId ,saveAddressCallback);
    }).on('click','#addAddRessBtn',function () {//添加收获地址
        var id = $(this).parents('div.blank-item').data('id');
        if(id == null || id == 'undefined'){
            id = 0;
        }
        initSaveAddress(id ,saveAddressCallback);
    }).on('click','.pay-type-sel-box',function () {//选择支付方式
        $(".pay-type-sel-box").removeClass("active");
        $(this).addClass('active');
    }).on('change','#activity-sel-box',function () {//选择活动
        var activityId = $(this).val();
        salesMap.activityId=activityId;
        //加载订单商品数据
        getPayOrderShopList();
    }).on('change','#coupon-code-sel-box',function () {//选择优惠券
        var couponCode = $(this).val();
        if(couponCode==null || $.trim(couponCode)==''){
            $("#coupon-code").val('');
        }else{
            $("#coupon-code").val(couponCode);
        }
        $("#coupon-code").removeAttr("readonly");
        $("#but-sub-box").show();
        $("#but-cancel-box").hide();
    }).on('click','#but-sub-box',function () {//确认使用优惠券
        var couponCode = $("#coupon-code").val();
        if(couponCode ==null || $.trim(couponCode)==''){
            icModale(0,'','请选择或输入优惠券编码');
            return;
        }
        $(this).hide();
        $("#but-cancel-box").show();
        $("#coupon-code").attr('readonly','readonly');
        salesMap.couponCode = couponCode;
        //加载订单商品数据
        getPayOrderShopList();
    }).on('click','#but-cancel-box',function () {//取消优惠券的使用
        $("#coupon-code").removeAttr('readonly');
        $("#coupon-code-sel-box").val('');
        $("#but-sub-box").show();
        $("#but-cancel-box").hide();
        $("#coupon-code").val('');
        salesMap.couponCode='';
        //加载订单商品数据
        getPayOrderShopList();
    }).on('click','#create-order-but',function () {//创建订单号
        var payType = getPayType();
        var activityId = $("#activity-sel-box").val();
        var couponCode = getCouponCode();
        var addressId  = 0;
        var address = '';
        var obj = getAddressData();
        if(obj!=null){
            addressId = obj.addressId;
            address = obj.address;
        }
        var params = {
            'payType':payType,
            'orderType': orderType,
            'shopData': shopData,
            'addressId': addressId,
            'address': address,
            'activityId':activityId,
            'code':couponCode
        };
        $.ajax({
            url:baseloaction +'/web/uc/order/createPayOrder',
            type:'post',
            dataType:'json',
            async:false,
            data:JSON.stringify(params),
            contentType:'application/json;charset=utf-8',
            success:function (result) {
                if(result.success==true){
                    layer.open({
                        type: 1,
                        title: '提示',
                        content: '支付结果是完成或遇到问题？',
                        btn: [' 完成支付', '遇到问题'],
                        area: 'auto',
                        btnAlign: 'c',
                        shade: [0.3, '#000000'],
                        skin: 'lay_ppComment__wrap',
                        yes: function(index, ele){
                            window.location.href = baseloaction +'/web/uc/order/list';
                        },
                        btn2:function (index,ele) {
                            window.location.href = baseloaction +'/web/uc/order/list';
                        }
                    });
                    window.open(baseloaction + result.url,'_blank');
                }else{
                    icModale(0,'',result.message);
                }
            },
            error:function (error) {
                icModale(0,'','系统错误，订单创建失败');
            }
        });
    }).on('click','#user-address-list .user-address-list-box',function () {//选择地址
        $(this).addClass("active");
        $(this).parent().siblings().find(".user-address-list-box").removeClass('active');
    })

    /**
     * 获取选中的支付类型
     * @return {string}
     */
    function getPayType() {
        var active = $(".pay-type-sel-box.active");
        if(active!=null && active.length > 0){
            return active.data('type');
        }
        return '';
    }

    /**
     * 获取优惠券编码
     * @return {jQuery}
     */
    function getCouponCode() {
        var couponCode = $("#coupon-code").val();
        if(couponCode==null || $.trim(couponCode)=='' || typeof  couponCode =='undefined'){
            couponCode ='';
        }else{
            var _readonly = $("#coupon-code").attr('readonly');
            if(typeof _readonly =='undefined'){
                couponCode ='';
            }
        }
        return couponCode;
    }

    /**
     * 获取选中的收货地址
     * @return {*}
     */
    function getAddressData() {
        var address = $("#user-address-list .user-address-list-box.active");
        if(address!=null && address.length >0){
            var addressId = address.data('id');
            var _address = address.data('address');
            var obj = {
                'addressId':addressId,
                'address':_address
            };
            return obj;
        }
        return null;
    }

    //加载订单商品数据
    getPayOrderShopList();


    /**
     * 获取支付订单的商品数据
     */
    function getPayOrderShopList(){
        $.ajax({
            url: baseloaction + '/web/uc/order/getPayOrderShopList',
            type:'post',
            dataType:'json',
            data:{
                'orderType':orderType,
                'shopData':shopData,
                'activityId':salesMap.activityId,
                'couponCode':salesMap.couponCode
            },
            success:function (result) {
                if(result.success == true){
                    showShopHtml(result.entity);
                    loadUserAddress(result.entity.haveBook);
                    showShopPrice(result.entity.orderPrice);

                    var filterActivity = false,filterCode =false;
                    if(salesMap.activityId > 0){
                        filterActivity = true;
                    }
                    if(salesMap.couponCode !=''){
                        filterCode = true;
                    }
                    if(filterCode== false || filterActivity==false){
                        //加载可使用的优惠券和活动
                        findOrderAvailableActivityAndCode(filterActivity,filterCode);
                    }else{
                        if(salesMap.couponCode !=''){
                            $("#coupon-code-sel-box").attr('disabled','disabled')
                        }
                    }
                }else{
                    icModale(0,'',result.message);
                }
            },
            error:function (error) {
                icModale(0,'','系统错误，获取订单商品失败');
            }
        });
    }

    /**
     * 显示商品数据
     * @param data
     */
    function showShopHtml(data) {
        var shopNum = data.shopNum;
        $("#shop-num-box").text(shopNum);
        $("#shop-num").text(shopNum);
        //商品列表
        var shopList = data.shopList;

        var context = '';
        $.each(shopList,function (index,shop) {
            shopMap[shop.shopId] = {
                shopId: shop.shopId,
                shopType: shop.shopType,
                name: shop.shopName,
                price:shop.realPrice,
                buyNum: shop.buyNum
            };
            context +='<section class="row order-course-item" id="shop-list-section-'+shop.shopType+'-'+shop.shopId+'">';
            context +='<input type="hidden" name="shopCartId" value="'+shop.shopCartId+'"/>';
            context +='<input type="hidden" name="shopType" value="'+shop.shopType+'"/>';
            context +='<input type="hidden" name="shopId" value="'+shop.shopId+'"/>';
            if(shop.shopType !='BOOK'){
                context +='<input type="hidden" name="buyNum" value="'+shop.buyNum+'"/>';
            }

                context +='<article class="col-sm-4">';
                context +='<div class="clearfix mr10">';
                context +='<div class="media">';
                var aText = 'javascript:void(0);';
                var tag = '';
                if(shop.shopType=='BOOK'){
                    tag = 'target="_blank"';
                    aText = baseloaction + '/web/book/info?bookId='+shop.shopId;
                }
                if(shop.shopType=='COURSE'){
                    tag = 'target="_blank"';
                    if(shop.course.courseTypeKey=='LIVE'){
                        aText =baseloaction + '/web/course/liveInfo?courseId='+shop.shopId;
                    }else{
                        aText =baseloaction + '/web/course/courseInfo?courseId='+shop.shopId;
                    }
                }
                //图片、课程的图片显示
                if(shop.shopType=='BOOK' || shop.shopType=='COURSE'){
                    context +=' <div class="media-left">';
                    context +='<a href="'+aText+'" '+tag+'>';
                    var imgUrl = '';
                    if(shop.shopType=='BOOK'){
                        imgUrl =shop.book.imageMap.pcUrlMap.small;
                    }else{
                        imgUrl =shop.course.imageMap.pcUrlMap.large;
                    }
                    context+='<img src="'+imgUrl+'" class="media-object" width="80" data-holder-rendered="true"/>';
                    context+='</a>';
                    context +='</div>';
                }
                context +='<div class="media-body">';
                context +='<section class="cm-desc-txt__twoLine">';
                context +='<a href="'+aText+'" '+tag+' class="fs14 c-999">'+shop.shopName+'</a>';
                context +='</section>';
                context +='</div>';
                context +='</div>';
                context +='</div>';
                context +='</article>';

            context +='<aside class="col-sm-3">';
            context +='<div class="text-center">';
            context +='<span class="fs12 c-999"><i class="fa fa-rmb"></i></span>';
            context +='<span class="fs16 c-999">'+parseFloat(shop.oldPrice).toFixed(2)+'</span>';
            if(shop.shopType=='BOOK'){
                context +='<br/>';
                context +='<span class="dd">';
                context +='<small class="btn-group btn-group-sm form-inline">';
                context +='<button class="btn btn-white minus-btn" type="button"><i class="fa fa-minus"></i></button>';
                context +='<input class="form-control text-center pull-left book-num-inp buy-num-in" value="'+shop.buyNum+'" name="buyNum" type="text" style="width: 50px;height: 30px"/>';
                context +='<button class="btn btn-white add-btn" type="button"><i class="fa fa-plus"></i></button>';
                context +='</small>';
                context +='</span>';
            }
            context +='</div></aside>';

            context +='<aside class="col-sm-2">';
            context +='<div class="text-center">';
            if(shop.shopType=='ACCOUNT'){
                context +='<span class="fs14 c-333">~</span>';
            }else{
                context +='<span class="fs14 c-333">￥'+parseFloat(shop.memberSubPrice  + shop.discountSubPrice + shop.activitySubPrice ).toFixed(2)+'</span>';
            }
            context +='</div></aside>';

            context +=' <aside class="col-sm-2">';
            context +='<div class="text-center">';
            context +='<span class="fs12 c-danger"><i class="fa fa-rmb"></i></span>';
            context +='<span class="fs16 c-danger">'+parseFloat(shop.realPrice).toFixed(2)+'</span>';
            context +='</div></aside>';
            if(data.shopData ==null || $.trim(data.shopData)==''){
                context +='<aside class="col-sm-1">';
                context +='<div class="text-center">';
                context +='<a title="删除" class="c-666 delete-shop-box" href="javascript:void(0);">';
                context +='<i class="fa fa-trash-o"></i></a>';
                context +='</div>';
                context +='</aside>';
            }
            context +='</section>';
        });
        $("#shop-list-box").html(context);
    }

    /**
     * 加载用户收货地址
     * @param haveBook 是否包含有图书数据
     */
    function loadUserAddress(haveBook) {
        if(haveBook==true){
            $("#freight-box").removeClass('hide');
            getUserAddressList();
        }else {
            $("#freight-box").addClass('hide');
        }
    }

    /**
     * 显示订单价格
     * @param orderPrice 价格对象
     */
    function showShopPrice(orderPrice) {
        $("#sum-price").text(parseFloat(orderPrice.sumPrice).toFixed(2));
        $("#yh-price").text(parseFloat(orderPrice.yhPrice + orderPrice.activityPrice).toFixed(2));
        $("#yhm-price").text(parseFloat(orderPrice.memberSubPrice).toFixed(2));
        $("#freight-price").text(parseFloat(orderPrice.freightPrice).toFixed(2));
        $("#real-price").text(parseFloat(orderPrice.realPrice).toFixed(2));

        if(orderType=='COMMON'){
            //账户金额
            var balance = $("#balance").val();
            var price = orderPrice.realPrice + orderPrice.freightPrice;
            if(balance >= price){
                $(".user-account-box-1").show();
                $(".user-account-box-2").hide();
                $(".user-account-box-1").find('[data-type]').addClass('active');
            }else{
                $(".user-account-box-1").hide();
                $(".user-account-box-2").show();
                $(".user-account-box-1").find('[data-type]').removeClass('active');
            }
            //coupon-box
            //
            var _yhPrice = orderPrice.activityPrice + orderPrice.yhPrice;
            if(_yhPrice  > 0){
                $("#coupon-box").removeClass('hide');
            }else{
                $("#coupon-box").addClass('hide');
            }
            if(orderPrice.memberSubPrice > 0){
                $("#member-box").removeClass("hide");
            }else{
                $("#member-box").addClass("hide");
            }
        }
    }


    /**
     * 保存用户地址信息
     * @param id
     * @param callback
     */
    function initSaveAddress(id,callback) {
        var title ='增加收货地址';
        var url = baseloaction +'/web/uc/initUpdate?addressId='+id;
        if(id>0){
            title ='修改收货地址'
            url = baseloaction +'/web/uc/initUpdate?addressId='+id;
        }
        layer.open({
            type: 2,
            title: title+'<span class="ml10 fs12 c-999"><small class="fs12 c-danger">*</small>为必填项</span>',
            area:['960px','480px'],
            shadeClose: true,
            maxmin:true,
            scrollbar: false,
            skin: 'layui-layer-demo',
            content: [url,'no'],
            btn: [' 确定 ', ' 取消 '],
            yes: function (index, layero) {
                var frame = parent.layer.getChildFrame('body', index);
                var params = frame.find('#addUserAddress').serializeJSON();
                params = JSON.stringify(params);
                $.ajax({
                    url: baseloaction + "/web/uc/ajax/saveUserAddress",
                    data: params,
                    dataType: "json",
                    type: "post",
                    contentType:'application/json;charset=utf-8',
                    success: function (result) {
                        icModale(0, "", result.message, null);
                        if (result.success == true) {
                            //重新加载用户收货地址
                            if($.isFunction(callback)){
                                callback();
                            }
                            layer.close(index);
                        }
                    }
                });
            },
            btn2: function (index, layero) {
                layer.close(index)
            }
        });
    }

    /**
     * 加载活动和优惠
     * @param filterActivity 是否过滤活动
     * @param filterCode 是否过滤优惠券
     */
    function findOrderAvailableActivityAndCode(filterActivity,filterCode) {
        if(orderType=='COMMON'){
            setTimeout(function () {
                var paramsList = new Array();
                $.each(shopMap,function (index,shop) {
                    if(index !=0){
                        paramsList.push({
                            'shopType':shop.shopType,
                            'price':shop.price+'',
                            'shopId':shop.shopId+''
                        });
                    }
                });
                $.ajax({
                    url:baseloaction +'/web/uc/order/findOrderAvailableActivityAndCode?filterCode='+filterCode+'&filterActivity='+filterActivity,
                    type:"post",
                    dataType:'json',
                    data:JSON.stringify(paramsList),
                    contentType:'application/json;charset=utf-8',
                    success:function (result) {
                        var activityList = result.activityList;
                        var couponCodeList = result.couponCodeList;

                        if(filterActivity ==false) {
                            if (activityList != null && activityList.length > 0) {
                                $("#activity-code-list").show();
                                showActivityHtml(activityList);
                            }
                        }
                        if(filterCode==false){
                            if (couponCodeList != null && couponCodeList.length > 0) {
                                $("#activity-code-list").show();
                                showCouponCodeHtml(couponCodeList);
                            }
                        }else{
                            $("#coupon-code-sel-box").attr('disabled','disabled');
                        }
                    },
                    error:function (error) {
                        icModale(0,'','系统错误，活动和优惠加载失败');
                    }
                });
            },300);
        }
    }

    /**
     * 显示活动HTML
     * @param activityList 活动数据列表
     */
    function showActivityHtml(activityList) {
        var context = '';
        context +='<div class="clearfix pt10">';
        context +='<aside class="pull-left">';
        context +='<span class="fs20 c-warning"><i class="fa fa-flag"></i></span>';
        context +='<span class="ml10 fs20 c-333">促销活动</span>';
        context +='<span class="ml10 fs12 c-999">';
        context +='（您购买的课程满足以下）';
        context +='<small class="fs14 c-danger">'+activityList.length+'</small>';
        context +='个促销活动，请选择合适活动</span></aside></div>';
        context +='<div class="mt20 ml20 mr20">';
        context +='<div class="row">';
        context +='<section class="col-sm-6">';
        context +='<select class="form-control" id="activity-sel-box">';
        context +='<option value="0">选择活动</option>';
        $.each(activityList,function (index,activity) {
            var text = '';
            if(activity.activityType.indexOf('1')!=-1){
                text = '满'+activity.askAmount+'减'+activity.subAmount;
            }
            if(activity.activityType.indexOf('2')!=-1){

                if(activity.giftType.indexOf('1')!=-1){
                    text = '-满'+activity.askAmount+'赠';
                    text+='课程&nbsp;';
                    var courses = activity.course;
                    if(courses!=null){
                        var courseNames ="";
                        for(i=0;i<courses.length;i++){
                            courseNames +=courses[i].courseName+ ",";
                        }
                        courseNames = courseNames.substring(0, courseNames.length - 1);
                        if(courseNames!=null&&courseNames!=''){
                            text+="("+courseNames+")&nbsp;";
                        }
                    }
                }
                if(activity.giftType.indexOf('3')!=-1){
                    text+='&nbsp;赠'+activity.integral+'积分';
                }
            }
            if(salesMap.activityId==activity.id){
                context +='<option selected value="'+activity.id+'">'+activity.activityName+text+'</option>';
            }else{
                context +='<option value="'+activity.id+'">'+activity.activityName+text+'</option>';
            }
        });
        context +='</select></section></div></div><hr>';
        $("#activity-list-box").html(context);
    }

    /**
     * 显示优惠券HTML
     * @param couponCodeList 优惠券数据列表
     */
    function showCouponCodeHtml(couponCodeList) {
        var  context = '';
        context+='<div class="clearfix pt10">';
        context+='<aside class="pull-left">';
        context+='<span class="fs20 c-warning"><i class="fa fa-tags"></i></span>';
        context+='<span class="ml10 fs20 c-333 hand">优惠券</span>';
        context+='<span class="ml10 fs12 c-999">';
        context+='优惠券仅优惠于课程商品';
        context+='</span></aside></div>';
        context+='<div class="mt20 ml20 mr20">';
        context+='<div class="row">';
        context+='<section class="col-sm-7">';
        context+='<div class="alert alert-warning">';
        context+='<h6 class="mb20"><i class="fa fa-circle-o-notch"></i> 使用优惠券抵销部分现金</h6>';
        context+='<section class="row">';
        context+='<aside class="col-sm-3 text-right">';
        context+='<span>选择优惠券：</span>';
        context+='</aside>';
        context+='<div class="col-sm-8">';
        if(salesMap.couponCode !=null && salesMap.couponCode !=''){
            context+='<select disabled class="form-control" id="coupon-code-sel-box" name="couponCode">';
        }else{
            context+='<select class="form-control" id="coupon-code-sel-box" name="couponCode">';
        }
        context+='<option value="">请选择优惠券</option>';
        if(couponCodeList !=null && couponCodeList !=''){
            $.each(couponCodeList,function (index,couponCode) {
                if(salesMap.couponCode ==couponCode.code){
                    context+='<option selected value="'+couponCode.code+'">'+couponCode.coupon.title+'-满'+couponCode.coupon.minAmount;
                }else{
                    context+='<option value="'+couponCode.code+'">'+couponCode.coupon.title+'-满'+couponCode.coupon.minAmount;
                }
                if(couponCode.coupon.type==2){//立减
                    context+='立减￥'+couponCode.coupon.limitAtion;
                }
                if(couponCode.coupon.type==1){//折扣
                    context+='打'+couponCode.coupon.limitAtion+'折';
                }
                context+='</option>';
            });
        }
        context+='</select></div></section>';
        context+='<div class="mt20">';
        context+='<section class="row">';
        context+='<aside class="col-sm-3 text-right">';
        context+='<span>优惠券编码：</span></aside>';
        context+='<div class="col-sm-8">';
        context+='<div class="form-inline">';
        context+='<div class="form-group">';
        if(salesMap.couponCode !=null && salesMap.couponCode !=''){
            context+=' <input type="text" readonly placeholder="请输入优惠券编码" id="coupon-code" value="'+salesMap.couponCode+'" class="form-control"/>';
        }else{
            context+=' <input type="text" placeholder="请输入优惠券编码" id="coupon-code" class="form-control"/>';
        }

        context+='</div>';
        if(salesMap.couponCode !=null && salesMap.couponCode !=''){
            context+='<button class="btn btn-warning ml5" id="but-sub-box" style="display: none;" type="button">确定</button>';
            context+='<button class="btn btn-warning ml5" id="but-cancel-box" type="button">取消</button>';
        }else{
            context+='<button class="btn btn-warning ml5" id="but-sub-box" type="button">确定</button>';
            context+='<button class="btn btn-warning ml5" id="but-cancel-box" style="display: none;" type="button">取消</button>';
        }
        context+='</div></div></section></div></div></section></div></div><hr>';
        $("#code-list-box").html(context);
    }

    /**
     * 更新购买量
     * @param em 操作的元素
     * @param type 1减，2加，3输入
     */
    function updateBuyNum(em, type) {
        var parent = em.parent("small").parent("span").parent("div").parent("aside").parent("section");
        var shopCartId = $(parent).find("[name='shopCartId']").val();
        var buyNum = 0;
        var buyNumEm = null;
        if (type == 1) {
            buyNum = $(em).next('input').val();
            if (buyNum < 2) {
                return;
            }
            buyNum--;
            buyNumEm = $(em).next('input');
        } else if (type == 2) {
            buyNum = $(em).prev("input").val();
            buyNum++;
            buyNumEm = $(em).prev('input');
        } else if (type == 3) {
            buyNum = em.val();
            var reg = /^[0-9]+$/;
            if (!reg.test(buyNum)) {
                buyNum = 1;
            }
            buyNumEm = em;
        }
        if (buyNum < 1) {
            buyNum = 1;
        }
        $(buyNumEm).val(buyNum);
        setTimeout(function () {
            var oldBuyNum = $(buyNumEm).val();
            _updateBuyNum(shopCartId, buyNum, oldBuyNum)
        }, 500);
    }

    //执行修改
    function _updateBuyNum(shopCartId, buyNum, oldBuyNum) {
        if (buyNum != oldBuyNum) {
            return;
        }
        if (shopCartId != null && $.trim(shopCartId) != '' && shopCartId > 0) {
            $.ajax({
                url: baseloaction + '/web/uc/shopCar/updateShopCartNum',
                type: 'post',
                dataType: 'json',
                data: {
                    "shopCartId": shopCartId,
                    'buyNum': buyNum
                },
                success: function (result) {
                    if (result.success == false) {
                        icModale(0, "", result.message);
                    } else {
                        //加载订单商品数据
                        setTimeout(function () {
                            getPayOrderShopList();
                        },300);
                    }
                },
                error: function (error) {
                    icModale(0, "", "系统错误，更新图书购买量失败");
                }
            });
        }else{
            var dataList = $("#shop-list-box>section.order-course-item");
            if(dataList!=null && dataList.length >0){
                shopData = dataList.map(function () {
                    var _shopData = $(this).find('input[name="shopId"]').val()+'-'+$(this).find('input[name="shopType"]').val()+'-'+$(this).find('input[name="buyNum"]').val();
                    return _shopData;
                }).get().join(",");
                getPayOrderShopList();
            }
        }
    }

});

/**
 * 保存用户地址信息回调访求
 */
function saveAddressCallback(){
    getUserAddressList();
}

/**
 * 获取用户收货地址
 */
function getUserAddressList() {
    setTimeout(function () {
        //如果有图书商品的情况下，查询用户收货地址
        $.ajax({
            url:baseloaction +'/web/uc/order/findUserAddressList',
            type:'post',
            dataType:'text',
            success:function (result) {
                $("#user-address-list").html(result);
                $("#user-address-list").show();
            },
            error:function (error) {
                icModale(0,'','系统错误，用户收货地址获取失败');
            }
        });
    },210);
}
